import request from '@/utils/request'
import fileRequest from '@/utils/fileRequest'


/*TODo 注意,如果是psot请求,不加params  ,get请求需要加上*/
// 修改密码
export const uploadUrl = "http://localhost:9093/blog/icon/uploadExcel";



// 分页
export function iconPage(current,size) {
  let data = {
    "current":current,
    "size":size
  };
  return request({
    url: '/icon/page',
    method: 'get',
    params:data
  })
}

// 分页
export function deleteIcon(id) {
  let data = {
    "id":id + ''
  };
  return request({
    url: '/icon/deleteIcon',
    method: 'delete',
    params: data
  })
}

/**
 * 模板下载
 */
export function downTemplate() {
    fileRequest({
    url: '/icon/downTemplate',
    method: 'get',
    responseType:'blob'
  });
}


// 查询所有的icon,未禁用
export function iconList() {
  return request({
    url: '/icon/iconList',
    method: 'get',
  })
}

// 详情
export function getById(id) {
  let data = {
    "id":id + '',
  };
  return request({
    url: '/icon/getById',
    method: 'get',
    params:data
  })
}


// 编辑/修改
export function saveOrUpdate(obj) {
  let data = {
    "id":obj.id,
    "type":obj.type,
    "color":obj.color,
    "size":obj.size,
  };
  return request({
    url: '/icon/saveOrUpdate',
    method: 'post',
   data
  })
}

// 图标置顶
export function topIcon(id){
  let data = {
    "id":id+'',
  };
  return request({
    url: '/icon/topIcon',
    method: 'put',
    params:data
  })
}

// 导出excel
export function exportExcel(){
  let data = {
  };
   fileRequest({
    url: '/icon/exportIcon',
    method: 'get',
    params:data,
     responseType:'blob'
  })
}




